package com.yanqu.road.entity.activity.foxcard;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.math.BigInteger;

@FieldTypeAnnotation(tableName = "t_u_activity_fox_monster", desc = "狐妖小红娘怪兽数据")
public class UserFoxCardMonster extends DataObject {
    @FieldTypeAnnotation(select = true, isIndex = true, update = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "玩家id", select = true, isIndex = true, update = true)
    private long userId;
    @FieldTypeAnnotation(desc = "回合", isIndex = true, update = true)
    private int round;
    @FieldTypeAnnotation(desc = "跳过效果")
    private int skipEffect;
    @FieldTypeAnnotation(desc = "boss限制")
    private int bossLimitEffect;
    @FieldTypeAnnotation(desc = "血量")
    private BigInteger hp = BigInteger.ZERO;

    public UserFoxCardMonster(int round) {
        this.round = round;
    }

    public UserFoxCardMonster() {
    }

    public UserFoxCardMonster(int activityId, long userId, int round) {
        this.activityId = activityId;
        this.userId = userId;
        this.round = round;
        setInsertOption();
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public int getRound() {
        return round;
    }

    public void setRound(int round) {
        this.round = round;
    }

    public int getSkipEffect() {
        return skipEffect;
    }

    public void setSkipEffect(int skipEffect) {
        if (this.skipEffect != skipEffect) {
            this.skipEffect = skipEffect;
            setUpdateOption();
        }
    }

    public int getBossLimitEffect() {
        return bossLimitEffect;
    }

    public void setBossLimitEffect(int bossLimitEffect) {
        if (this.bossLimitEffect != bossLimitEffect) {
            this.bossLimitEffect = bossLimitEffect;
            setUpdateOption();
        }
    }

    public BigInteger getHp() {
        return hp;
    }

    public void setHp(BigInteger hp) {
        if (this.hp.compareTo(hp) != 0) {
            this.hp = hp;
            setUpdateOption();
        }
    }

    public UserFoxCardMonster clone() {
        UserFoxCardMonster monster = new UserFoxCardMonster();
        monster.setRound(this.getRound());
        monster.setSkipEffect(this.getSkipEffect());
        monster.setBossLimitEffect(this.getBossLimitEffect());
        monster.setHp(this.getHp());
        return monster;
    }

    public void resetValue() {
        this.setSkipEffect(0);
        this.setHp(BigInteger.ZERO);
        this.setBossLimitEffect(0);
    }
}
